package com.yndsoft.jc.supplier.utils;

import android.os.CountDownTimer;
import android.widget.Button;

public class CountDownTimerUtil extends CountDownTimer {
    private Button button;

    public CountDownTimerUtil(Button button) {
        super(60000L, 1000L);
        this.button = button;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        button.setClickable(false);
        button.setText("" + millisUntilFinished / 1000 + "s");
        button.setTextColor(0xFF999999);
    }

    @Override
    public void onFinish() {
        button.setText("重新获取");
        button.setClickable(true);
    }
}
